import React from "react";
import './index.scss'

const Radio: React.FC<any> = (props) => {
  return (
    <>
      <input
        className='radio'
        type='radio'
        name={props.name}
        value={props.value}
        id={`${props.name}-${props.value}`}
        style={{display: 'none'}}
        defaultChecked={!!props.default}
        onChange={e => {
          props.checked(e.target.value)
        }}
      />
      <label className='label' htmlFor={`${props.name}-${props.value}`}>{props.label}</label>
    </>
  )
}

export default Radio
